/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.giant.entities.pos;

import com.giant.entities.TypeTax;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author david
 */
@Entity
@Table(name = "p_invoice_tax")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "PInvoiceTax.findAll", query = "SELECT p FROM PInvoiceTax p"),
    @NamedQuery(name = "PInvoiceTax.findByIdInvoiceTax", query = "SELECT p FROM PInvoiceTax p WHERE p.idInvoiceTax = :idInvoiceTax"),
    @NamedQuery(name = "PInvoiceTax.findByTotalValue", query = "SELECT p FROM PInvoiceTax p WHERE p.totalValue = :totalValue")})
public class PInvoiceTax implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_invoice_tax")
    private Integer idInvoiceTax;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "total_value")
    private Float totalValue;
    @JoinColumn(name = "id_type_tax", referencedColumnName = "id_type_tax")
    @ManyToOne(optional = false)
    private TypeTax idTypeTax;
    @JoinColumn(name = "id_invoice", referencedColumnName = "id_invoice")
    @ManyToOne(optional = false)
    private PInvoice idInvoice;

    public PInvoiceTax() {
    }

    public PInvoiceTax(Integer idInvoiceTax) {
        this.idInvoiceTax = idInvoiceTax;
    }

    public Integer getIdInvoiceTax() {
        return idInvoiceTax;
    }

    public void setIdInvoiceTax(Integer idInvoiceTax) {
        this.idInvoiceTax = idInvoiceTax;
    }

    public Float getTotalValue() {
        return totalValue;
    }

    public void setTotalValue(Float totalValue) {
        this.totalValue = totalValue;
    }

    public TypeTax getIdTypeTax() {
        return idTypeTax;
    }

    public void setIdTypeTax(TypeTax idTypeTax) {
        this.idTypeTax = idTypeTax;
    }

    public PInvoice getIdInvoice() {
        return idInvoice;
    }

    public void setIdInvoice(PInvoice idInvoice) {
        this.idInvoice = idInvoice;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idInvoiceTax != null ? idInvoiceTax.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PInvoiceTax)) {
            return false;
        }
        PInvoiceTax other = (PInvoiceTax) object;
        if ((this.idInvoiceTax == null && other.idInvoiceTax != null) || (this.idInvoiceTax != null && !this.idInvoiceTax.equals(other.idInvoiceTax))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.giant.entities.PInvoiceTax[ idInvoiceTax=" + idInvoiceTax + " ]";
    }
    
}
